from django.db import models
from django.contrib.auth.models import User

# Create your models here.
class Task(models.Model):
    person = models.ForeignKey(User)
    name = models.CharField(max_length=100)
    time = models.IntegerField()
    begindate = models.DateField()
    enddate = models.DateField(null=True)
    endreason = models.SmallIntegerField(null=True)
    
    def __unicode__(self):
        return self.person.username + ' (' + self.begindate.__str__() + ' - ' + self.enddate.__str__() + '[' + self.endreason.__str__() + '])'
    
class GraphData(models.Model):
    person = models.ForeignKey(User)
    date = models.DateField()
    taskcount = models.IntegerField()
    timecount = models.IntegerField()
    
    def __unicode__(self):
        return '[' + self.date.__str__() + '] ' + self.person.username + ': ' + self.taskcount.__str__() + ' (' + self.timecount.__str__() + ')' 